package com.chixing.day03_oop;
public class Account {
    private int accNo;
    private String accName;
    private int accPassword;
    private int accTelno;
    private int accBalance;
    private int accType;
    public int getAccNo() {
        return accNo;
    }
    public void setAccNo(int accNo) {
        this.accNo = accNo;
    }
    public String getAccName() {
        return accName;
    }
    public void setAccName(String accName) {
        this.accName = accName;
    }
    public int getAccPassword() {
        return accPassword;
    }
    public void setAccPassword(int accPassword) {
        this.accPassword = accPassword;
    }
    public int getAccTelno() {
        return accTelno;
    }
    public void setAccTelno(int accTelno) {
        this.accTelno = accTelno;
    }
    public int getAccBalance() {
        return accBalance;
    }
    public void setAccBalance(int accBalance) {
        this.accBalance = accBalance;
    }
    public int getAccType() {
        return accType;
    }

    public void setAccType(int accType) {
        this.accType = accType;
    }
    //方法
    public void show(){
        String acc = null;
        if (accType == 0)
             acc = "储蓄账户";
        else if (accType == 1)
             acc = "信用账户";
        System.out.println("账号："+this.accNo+" ，户主姓名："+this.accName+" ，密码："+this.accPassword+"，手机号："+ this.accTelno+
                "，账号余额："+this.accBalance+"，账号类型:"+acc);
    }
    public void depoist(int x){
        this.accBalance = x+this.accBalance;
        System.out.println("存入"+x+"元，余额为"+this.accBalance);
    }
    public void withdraw(int n){
        if (n>this.accBalance){
            System.out.println("余额不足");
        }else {
            this.accBalance =this.accBalance - n;
            System.out.println("取出"+n+"元，余额为"+this.accBalance);
        }
    }
}
